Fix null-ref crash in CLRMA when querying nested exceptions on message-only fail-fast#5889
Merged
hoyosjs merged 3 commits intoJun 19, 2026
Merged
Conversation
…e-only fail-fast The runtime emit a triage JSON with no "exception" block when Environment.FailFast() is called without an exception (e.g. a garbage- collected delegate). CrashInfoService parsed this correctly but left _exception null, which caused a null-ref crash downstream in CLRMA when iterating nested exceptions. Adds a regression test covering the Delegate_GarbageCollected payload seen in a dump
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a null-reference crash in CLRMA when processing NativeAOT triage JSON produced by Environment.FailFast() without an exception block (message-only fail-fast). The change makes nested-exception enumeration resilient to missing crash exceptions and adds a regression unit test for the observed Delegate_GarbageCollected payload.
Changes:
- Update
CrashInfoService.GetNestedExceptionsto return an empty sequence when no crash exception exists, and to tolerate null inner-exception collections/elements. - Add a defensive guard in CLRMA
ThreadWrapperto avoid constructing nested exception wrappers when the thread exception is absent. - Add a unit test covering message-only NativeAOT crash info parsing and nested-exception querying.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/CrashInfoServiceTests.cs | Adds regression test for message-only NativeAOT triage JSON (no exception block). |
| src/SOS/SOS.Extensions/Clrma/ThreadWrapper.cs | Avoids nested-exception wrapping when there is no thread exception (prevents CLRMA null-ref path). |
| src/Microsoft.Diagnostics.DebugServices.Implementation/CrashInfoService.cs | Returns empty nested-exception enumeration when _exception is missing and hardens recursive enumeration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Suggestions seem reasonable. Otherwise looks good |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
steveisok
approved these changes
Jun 18, 2026
steveisok
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The runtime emit a triage JSON with no "exception" block when
Environment.FailFast() is called without an exception (e.g. a garbage-
collected delegate). CrashInfoService parsed this correctly but left
_exception null, which caused a null-ref crash downstream in CLRMA when iterating nested exceptions.
Adds a regression test covering the Delegate_GarbageCollected payload seen in a dump